home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD World 1998 January
/
CD World - Ocak 1998.iso
/
misc
/
dbase55
/
disk7
/
samples1.pak
/
SYSINFO.WFM
< prev
next >
Wrap
Text File
|
1995-07-18
|
10KB
|
331 lines
**************************************************************************
* PROGRAM: Sysinfo.wfm
*
* WRITTEN BY: Borland Samples Group
*
* DATE: 5/93
*
* UPDATED: 7/94
*
* REVISION: $Revision: 1.49 $
*
* VERSION: Visual dBASE
*
* DESCRIPTION: This form displays information about your system.
* It uses Windows API functions called externally from
* Visual dBASE to obtain that information.
*
* PARAMETERS: None
*
* CALLS: Buttons.cc (Custom Controls file)
*
* USAGE: do Sysinfo.wfm
* or
* set procedure to Sysinfo.wfm additive
* local f
* f = new SysInfo()
* f.mdi = .F. && modal forms cannot be mdi
* f.ReadModal()
*
*******************************************************************************
#include <Winapi.h>
#define HIWORD(x) (bitand(bitrshift(x,16),2^16-1))
#define LOWORD(x) (bitand(x,2^16-1))
#define HIBYTE(x) (bitand(bitrshift(x,8),2^8-1))
#define LOBYTE(x) (bitand(x,2^8-1))
#define STRHIBYTE(x) ltrim(str(HIBYTE(x)))
#define STRLOBYTE(x) ltrim(str(LOBYTE(x)))
create session
set talk off
set ldCheck off
** END HEADER -- do not remove this line*
* Generated on 07/11/95
*
parameter bModal
local f
f = new SYSINFOFORM()
if (bModal)
f.mdi = .F. && ensure not MDI
f.ReadModal()
else
f.Open()
endif
CLASS SYSINFOFORM OF FORM
Set Procedure To &_dbwinhome.samples\BUTTONS.CC additive
this.OnOpen = CLASS::ONOPEN
this.Width = 52.833
this.OnClose = CLASS::ONCLOSE
this.Top = 8.4111
this.MousePointer = 1
this.Left = 26.333
this.Text = "Windows System Information"
this.Height = 13.1172
this.Maximize = .F.
this.Minimize = .F.
this.MDI = .F.
DEFINE RECTANGLE RECTANGLE1 OF THIS;
PROPERTY;
Width 50.1807,;
Top 0.5391,;
Left 1.3193,;
Text "",;
Height 10.0488
DEFINE TEXT INSTANCESTEXT OF THIS;
PROPERTY;
Width 23.8604,;
Top 1.0596,;
Left 2.6396,;
Text "Visual dBASE Instances:",;
Height 1.3193,;
Alignment 2
DEFINE TEXT WINVERSIONTEXT OF THIS;
PROPERTY;
Width 23.8604,;
Top 2.3799,;
MousePointer 1,;
Left 2.6396,;
Text "Windows Version:",;
Height 1.2666,;
Alignment 2
DEFINE TEXT MODETEXT OF THIS;
PROPERTY;
Width 23.8604,;
Top 3.7197,;
MousePointer 1,;
Left 2.6396,;
Text "Mode of Operation:",;
Height 1.2803,;
Alignment 2
DEFINE TEXT CPUTEXT OF THIS;
PROPERTY;
Width 23.8604,;
Top 5.0391,;
MousePointer 1,;
Left 2.6396,;
Text "CPU Type:",;
Height 1.3193,;
Alignment 2
DEFINE TEXT COPROCTEXT OF THIS;
PROPERTY;
Width 23.8604,;
Top 6.3594,;
MousePointer 1,;
Left 2.6396,;
Text "Coprocessor Present:",;
Height 1.2871,;
Alignment 2
DEFINE TEXT GLOBFREETEXT OF THIS;
PROPERTY;
Width 23.8604,;
Top 7.6895,;
MousePointer 1,;
Left 2.6396,;
Text "Free Global Memory:",;
Height 1.3193,;
Alignment 2
DEFINE TEXT DOSVERSTEXT OF THIS;
PROPERTY;
Width 23.8604,;
Top 9.0098,;
MousePointer 1,;
Left 2.6396,;
Text "DOS Version:",;
Height 1.2842,;
Alignment 2
DEFINE ENTRYFIELD INSTANCESENTRY OF THIS;
PROPERTY;
Width 19.79,;
Top 1.0596,;
Left 27.71,;
ColorNormal "B/BtnFace",;
Height 1.3193,;
Enabled .F.,;
Border .F.,;
Value " "
DEFINE ENTRYFIELD WINVERSIONENTRY OF THIS;
PROPERTY;
Width 19.79,;
Top 2.3799,;
Left 27.71,;
ColorNormal "B/BtnFace",;
Height 1.2666,;
Enabled .F.,;
Border .F.,;
Value " "
DEFINE ENTRYFIELD MODEENTRY OF THIS;
PROPERTY;
Width 23.123,;
Top 3.7197,;
Left 27.71,;
ColorNormal "B/BtnFace",;
Height 1.2803,;
Enabled .F.,;
Border .F.,;
Value " "
DEFINE ENTRYFIELD CPUENTRY OF THIS;
PROPERTY;
Width 19.79,;
Top 5.0391,;
Left 27.71,;
ColorNormal "B/BtnFace",;
Height 1.3193,;
Enabled .F.,;
Border .F.,;
Value " "
DEFINE ENTRYFIELD COPROCENTRY OF THIS;
PROPERTY;
Width 19.79,;
Top 6.3594,;
Left 27.71,;
ColorNormal "B/BtnFace",;
Height 1.2871,;
Enabled .F.,;
Border .F.,;
Value " "
DEFINE ENTRYFIELD GLOBFREEENTRY OF THIS;
PROPERTY;
Width 19.79,;
Top 7.6895,;
Left 27.71,;
ColorNormal "B/BtnFace",;
Height 1.3193,;
Enabled .F.,;
Border .F.,;
Value " "
DEFINE ENTRYFIELD DOSVERSENTRY OF THIS;
PROPERTY;
Width 19.79,;
Top 9.0098,;
Left 27.71,;
ColorNormal "B/BtnFace",;
Height 1.2842,;
Enabled .F.,;
Border .F.,;
Value " "
DEFINE CLOSEBUTTON CLOSEBUTTON1 OF THIS;
PROPERTY;
Width 14.1934,;
Group .T.,;
Top 11.1396,;
Left 19.1396,;
Height 1.5
procedure OnOpen
* Called by Sysinfo(). This function makes the necessary API calls, and assigns
* the accessed information to variables that will be displayed in the form
* showing system information.
********************************************************************************
*extern CLONG GetFreeSpace(CINT) KERNEL
set procedure to &_dbwinhome.samples\Sampproc.prg additive && for Format functions
local mHandle, mInstance, mFlags, mCpu, mFreeMem, wFreeMem, mCoprocess
mHandle = GetModuleHandle(ansi("DBASEWIN.EXE")) && Get Visual dBASE handle
ShowWindow(mHandle,7) && 7 make icon not active
mInstance = GetModuleUsage(mHandle) && Number of Visual dBASE instances
mFlags = GetWinFlags()
do case && Check which mode Windows running in
case mFlags = BitOr(mFlags,2)
mMode = "Running Win286"
case mFlags = BitOr(mFlags,16)
mMode = "Standard Mode"
case mFlags = BitOr(mFlags,32)
mMode = "Enhanced Mode"
endcase
do case && Check processor type
case mFlags = BitOr(mFlags,8)
mCpu = "80486"
case mFlags = BitOr(mFlags,4)
mCpu = "80386"
case mFlags = BitOr(mFlags,2)
mCpu = "80286"
case mFlags = BitOr(mFlags,128)
mCpu = "80186"
case mFlags = BitOr(mFlags,64)
mCpu = "8086"
endcase
mCoprocess = IIF(mFlags = BitOr(mFlags,1024), "Yes", "No ")
mFreeMem = FormatStr("%1 K", ltrim(str(memo())))
wFreeMem = FormatStr("%1 K", ltrim(str(GetFreeSpace(0)/1024)))
form.instancesEntry.value = ltrim(str(mInstance))
form.winVersionEntry.value = CLASS::GetVersion("WIN") && Get Windows version
form.modeEntry.value = mMode
form.cpuEntry.value = mCpu
form.coprocEntry.value = mCoprocess
form.globFreeEntry.value = wFreeMem
form.dosVersEntry.value = CLASS::GetVersion("DOS") && Get DOS version
form.visible = .T. && So you don't see all controls painting
&& while they are defined
********************************************************************************
procedure OnClose
********************************************************************************
close procedure &_dbwinhome.samples\Buttons.cc,;
&_dbwinhome.samples\Sampproc.prg
********************************************************************************
procedure GetVersion (verType)
* Gets information from the Windows function
* GetVersion(), which returns the major and minor
* DOS and Windows versions as a CLONG.
*
*
* The "High Byte of the High Word" contains the
* major DOS version, the "Low Byte of the High Word"
* contains the minor DOS version. The "High Byte of
* the Low Word" specifies the minor version of
* Windows and the "Low byte of the Low Word"
* specifies the major Windows version. The Bit
* functions are used to extract the proper values.
* BitRshift(), BitAnd().
*
********************************************************************************
* EXTERN CLONG GetVersion(CVOID) KERNEL
local version, retVal
version = GetVersion( )
if upper(verType) = "DOS"
retVal = FormatStr("%1.%2",;
STRHIBYTE(HIWORD(version)), STRLOBYTE(HIWORD(version)))
elseif left(upper(verType),3) = "WIN"
retVal = FormatStr("%1.%2",;
STRLOBYTE(LOWORD(version)), STRHIBYTE(LOWORD(version)))
endif
return retVal
ENDCLASS